﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace cloud_music
{
    public partial class zhuym : Form
    {
        public zhuym()
        {
            InitializeComponent();
        }

        private Point mPoint;

        /// <summary>
        /// 鼠标按下
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void panel1_MouseDown(object sender, MouseEventArgs e)
        {
            mPoint = new Point(e.X, e.Y);
        }


        /// <summary>
        /// 鼠标移动
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void panel1_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                this.Location = new Point(this.Location.X + e.X - mPoint.X, this.Location.Y + e.Y - mPoint.Y);
            }

        }

        /// <summary>
        /// 关闭按钮单击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void guanbianniu_MouseClick(object sender, MouseEventArgs e)
        {
            Application.Exit();
        }


        //最大化窗口化判定
        bool azdhs = true;
        /// <summary>
        /// 最大化按钮单击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void zuidahua_MouseClick(object sender, MouseEventArgs e)
        {
            
            azdhs=zdhckh(azdhs);
        }

        /// <summary>
        /// 最大化窗口化变换方法
        /// </summary>
        /// <param name="azdhs"></param>
        /// <returns></returns>
        public bool zdhckh(bool azdhs)
        {
            if (azdhs)
            {
                this.WindowState = FormWindowState.Maximized;
                return false;
            }
            else
            {
                this.WindowState = FormWindowState.Normal;
                return true;
            }
        }
    }

}
